<?php
class Mivec_Product_Product extends Mivec_Product_Abstract
{
	protected $_product;
	protected $_collection;
	
	public function __construct()
	{
		parent::_init();
		
		$this->_product = parent::getProduct();
		return $this;
	}
	
	public function load($id)
	{
		$this->_product = parent::getProduct()->load($id);
		return $this;
	}
	
	public function getCollection()
	{
		$this->_collection = $this->_product->getCollection();
		return $this;
	}
	
	public function addAttributeToSelect(Mivec_Element_String $fields) 
	{
		if ($fields) {
			foreach ($fields->toArray() as $_field) {
				$this->_collection->addAttributeToSelect($_field);
			}
			return $this;
		}
	}
	
	public function addAttributeToFilter($key,$params=array())
	{
		$this->_collection->addAttributeToFilter($key,$params);
		return $this;
	}
	
	public function count()
	{
		return $this->_collection->count();
	}
	
	public function getItems()
	{
		return $this->_collection->getItems();
	}
	
}